home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 2_2.lha / 2_2 / 2_2_tst.c < prev    next >
Text File  |  1993-08-08  |  615b  |  31 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. include <stream.h>
  6. include <complex.h>
  7.  
  8. omplex lsqrt(complex);
  9.  
  10. oid tst(complex c)
  11.  
  12.    cout << "c=" << c << "\n";
  13.    complex d = sqrt(c);
  14.    complex dl = lsqrt(c);
  15.    cout << "sqrt(c)=" << d << "\t" << dl << "\n";
  16.    complex e = d * d;
  17.    complex el = dl * dl;
  18.    cout << "c=" << e << "\t" << el << "\n\n";
  19.  
  20.  
  21. ain()
  22.  
  23.    tst(complex(1, -3));
  24.    tst(complex(-3, 1));
  25.    tst(complex(3, 0));
  26.    tst(complex(0, 3));
  27.    tst(complex(-3, 0));
  28.    tst(complex(0, -3));
  29.    return 0;
  30.  
  31.